package com.zhn.evsi.controller.System;

import com.zhn.evsi.common.Result;
import com.zhn.evsi.task.Evsi.EvsiCounterTask;
import com.zhn.evsi.task.Evsi.EvsiMarketTask;
import com.zhn.evsi.task.Evsi.EvsiWalletTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.mail.MessagingException;

@Api(tags = "定时器管理")
@RestController
@RequestMapping("定时器管理")
public class SysTaskController {

    @Resource
    private EvsiMarketTask evsiMarketTask;

    @Resource
    private EvsiWalletTask evsiWalletTask;

    @Resource
    private EvsiCounterTask evsiCounterTask;

    @ApiOperation("物品价格更新")
    @ApiOperationSupport(order = 1)
    @GetMapping("/EvsiMarketTask")
    public Result evsiMarketTask() {
        evsiMarketTask.MarketTask();
        return Result.success();
    }

    @ApiOperation("邮件发送")
    @ApiOperationSupport(order = 2)
    @GetMapping("/WalletTask")
    public Result WalletTask() throws MessagingException {
        evsiWalletTask.WalletTask();
        return Result.success();
    }

    @ApiOperation("计时器日存储")
    @ApiOperationSupport(order = 3)
    @GetMapping("/counterDay")
    public Result counterDay() {
        evsiCounterTask.counterDay();
        return Result.success();
    }

    @ApiOperation("计时器周存储")
    @ApiOperationSupport(order = 3)
    @GetMapping("/counterWeek")
    public Result counterWeek() {
        evsiCounterTask.counterWeek();
        return Result.success();
    }


}
